# Problem 7
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
# What is the 10001st prime number?

import unittest
import Utility

def findNthPrime(Nth):
    cur = 1
    i = 2
    while True:
        if Utility.isPrime(i):
            cur += 1
        if cur > Nth:
            break
        i += 1
    return i

    
class TestP007(unittest.TestCase):
    def test_findNthPrime(self):
        self.assertEqual(findNthPrime(1), 2)
        self.assertEqual(findNthPrime(3), 5)
        self.assertEqual(findNthPrime(6), 13)
        self.assertEqual(findNthPrime(10001), 104743)
        


if __name__ == '__main__':
    P007 = unittest.TestLoader().loadTestsFromTestCase(TestP007)
    unittest.TextTestRunner(verbosity=2).run(P007)
    print "the 10001st prime number is [%d]" % findNthPrime(100001)